package pers.andy.websocket.controller;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import pers.andy.websocket.cache.SystemCache;
import pers.andy.websocket.vo.MeetingVO;

/**
 * 会议创建入口
 * @author Andy.ye
 * @date 2018年4月8日 下午7:44:58
 */
@Controller
@RequestMapping("/meeting")
public class MeetingController {

	private static AtomicInteger id = new AtomicInteger(0);

	private static final Log LOG = LogFactory.getLog(MeetingController.class);

	@RequestMapping("/create")
	@ResponseBody
	public MeetingVO createMeeting() {
		int meetingId = id.incrementAndGet();
		String randStr = RandomStringUtils.random(6, true, true);
		SystemCache.idRandStrMap.put(meetingId, randStr);
		MeetingVO meetingVO = new MeetingVO();
		meetingVO.setId(meetingId);
		meetingVO.setRandStr(randStr);
		return meetingVO;
	}
}